package com.youlu.campus.website.controller;

import com.youlu.campus.common.base.QResult;
import com.youlu.campus.website.common.enums.PlatformType;
import com.youlu.campus.website.entity.ActivityDescriptionTypeVo;
import com.youlu.campus.website.entity.ActivityType;
import com.youlu.campus.website.service.ActivityDescriptionTypeService;
import com.youlu.campus.website.service.ActivityTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 活动简介与类型 控制器
 */
@RestController
@RequestMapping("/api/activity/type")
public class ActivityDescriptionTypeController {

    @Autowired
    private ActivityDescriptionTypeService activityDescriptionTypeService;

    @Autowired
    private ActivityTypeService activitTypeService;

    /**
     * 根据平台获取启用的轮播图列表（前端用）
     *
     * @return
     */
    @GetMapping("/find-list")
    public QResult<List<ActivityDescriptionTypeVo>> findList(@RequestHeader("platform") PlatformType platform) {
        List<ActivityDescriptionTypeVo> activityTitleTypes = activityDescriptionTypeService.listEnabledType(platform);
        return QResult.success(activityTitleTypes);
    }

    /**
     * 根据平台获取启用的轮播图列表（前端用）
     *
     * @return
     */
    @GetMapping("/find-all")
    public QResult<List<ActivityType>> find() {
        List<ActivityType> activityTypes = activitTypeService.listEnabledType(50);
        return QResult.success(activityTypes);
    }
}
